package Ar;

import java.util.Scanner;

/**
 * @Author MDD
 * @Description
 * @Version
 * @Date
 **/
public class Code03 {
    public static void main(String[] args) {
        int[] a ;
        // a = {2,3,4,7,32,11};  错误的赋值方式
        //int[] b = {432,231,43,132,535};
        int[] c = {8,4,2,1,23,344,21};
        int sum = 0;
        for (int i:c) {
            System.out.print(i+"\t");
            sum += i;
        }
        System.out.println();
        System.out.println("和为："+sum);
        System.out.println("=====================");


        Scanner sc = new Scanner(System.in);
        System.out.print("请任意输入一个数：");
        int num = sc.nextInt();
        boolean isFind = false;
        for (int i = 0; i < c.length; i++) {
            if (c[i]==num){
                isFind = true;
                break;
            }
        }
        if (isFind){
            System.out.println(num+"在数列中");
        }
        else {
            System.out.println(num+"不在数列中");
        }


        System.out.println("=====================");





    }
}
